/**
 * 
 */
package com.zznode.client.wlanpolling.other;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

import com.zznode.client.wlanpolling.R;

/**
 * @author Bean
 *
 */
public class TestResultListAdapter extends CursorAdapter {
	private LayoutInflater mLayoutInflater;
	
	public TestResultListAdapter(Context context, Cursor cursor) {
		super(context, cursor);
		
		mLayoutInflater = LayoutInflater.from(context);
	}

	@Override
	public void bindView(View view, Context context, Cursor cursor) {
		String ssid = cursor.getString((cursor.getColumnIndex("ssid")));
		String bssid = cursor.getString(cursor.getColumnIndex("apMac"));
		String sCreateDate = cursor.getString(cursor.getColumnIndexOrThrow("testtime"));
		
		TextView tvSsid = (TextView)view.findViewById(R.id.tvSsid);
		tvSsid.setText(ssid + "(" + bssid + ")");
		
		TextView tvTesttime = (TextView)view.findViewById(R.id.tvTesttime);
		tvTesttime.setText(sCreateDate);
		
		view.setTag(cursor.getInt(cursor.getColumnIndex("_id")));
	}

	@Override
	public View newView(Context context, Cursor cursor, ViewGroup parent) {
		return mLayoutInflater.inflate(R.layout.testresultlist_listitem, null);
	}
	
	
}
